#if !defined(IFF_H)
#define IFF_H

/* ---------- general types ---------- */

typedef struct {
	unsigned char p[3];	// r,g,b
} iff_p3;

typedef struct {
    int height;
    int width;
    int depth;
    iff_p3 **data;
} iffimage;

/* ---------- IFF-related types ---------- */

char iffType[4];

typedef struct {
	char ID[4];				// BMHD
	unsigned int Size;
	unsigned int w;
	unsigned int h;
	unsigned int x;
	unsigned int y;
	char nPlanes;
	char masking;
	char compression;
	char pad1;
	int trclr;
	char xAspect;
	char yAspect;
	unsigned int pWidth;	// not (yet) used
	unsigned int pHeight;	// not (yet) used
} BMHD_chunk;

typedef struct {
	char ID[4];
	unsigned int Size;
	iff_p3* cmap;			// color map entries (3*N)
} CMAP_chunk;

typedef struct {			// Deluxe Paint ...
	char ID[4];
	unsigned int Size;
	// ...
} DPPS_chunk;

typedef struct {			// ...
	char ID[4];
	unsigned int Size;
	// ...
} CAMG_chunk;

typedef struct {
	char ID[4];
	unsigned int Size;
	unsigned char* Data;	// body entries x*y*<Word>,
							// on an Intel 32-bit machine
							// a word is 32 bit = 4 byte
} BODY_chunk;

/* ------------------------- functions ------------------------- */

/* load file as iff-image */
iffimage loadiff(char* filename);

/* print image intrinsics to stdout */
void printiff(BMHD_chunk* bmhd);

/* free memory etc. */
void freeiff(iffimage img);

#endif
